//
//  CustomView.m
//  UI-02 Homework 完成登录-注册-忘记密码
//
//  Created by 冀永金 on 16/7/15.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "CustomView.h"
#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height
@implementation CustomView
- (instancetype)initWithFrame:(CGRect)frame {
    return [self initWithFrame:frame leftImage:nil placeHolder:nil];
}
- (instancetype)initWithFrame:(CGRect)frame leftImage:(UIImage *)leftImage placeHolder:(NSString *)placeHolder {
    self = [super initWithFrame:frame];
    if (self) {
        [self config];
        _leftImage.image = leftImage;
        _rightTextField.placeholder = placeHolder;
    }
    return self;
}
- (void)config {
    self.leftImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH / 6, HEIGHT)];
    [self addSubview:self.leftImage];
    self.rightTextField = [[UITextField alloc]initWithFrame:CGRectMake(WIDTH / 6, 0, 5 *WIDTH / 6, HEIGHT)];
    [self addSubview:self.rightTextField];
    self.rightTextField.alpha = 0.8;
    self.rightTextField.backgroundColor = [UIColor colorWithRed:0.20 green:0.15 blue:0.10 alpha:1.00];
    self.leftImage.backgroundColor = [UIColor colorWithRed:0.16 green:0.16 blue:0.15 alpha:1.00];
    self.rightTextField.tintColor = [UIColor lightGrayColor];
    self.rightTextField.font = [UIFont systemFontOfSize:22];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
